﻿using System.Windows;

namespace zaklad_rtv
{
    public class AppEvents
    {
        public static readonly RoutedEvent DatabaseObjectChangedEvent =
            EventManager.RegisterRoutedEvent(
                "DatabaseObjectChanged",
                RoutingStrategy.Bubble,
                typeof(DatabaseObjectChangedEventHandler),
                typeof(AbstractForm));
    }

    public delegate void DatabaseObjectChangedEventHandler(object sender, DatabaseObjectChangedEventArgs args);

    public class DatabaseObjectChangedEventArgs : RoutedEventArgs
    {
        public IDatabaseObject Object { get; set; }
        public EventAction Action { get; set; }

        public DatabaseObjectChangedEventArgs(RoutedEvent routedEvent, object source, IDatabaseObject client, EventAction action)
            : base(routedEvent, source)
        {
            Object = client;
            Action = action;
        }
    }
}
